from cStringIO import StringIO

from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams
from pdfminer.pdfpage import PDFPage


rsrcmgr = PDFResourceManager()
retstr = StringIO()

device = TextConverter(rsrcmgr, retstr, codec='utf-8', laparams=LAParams())
interpreter = PDFPageInterpreter(rsrcmgr, device)

with open("21.pdf", 'rb') as fp:
    for page in PDFPage.get_pages(fp, set()):
        interpreter.process_page(page)        
    line_list=retstr.getvalue().splitlines()
device.close()
retstr.close()
print line_list[2]

